import { request, uploadRequest } from "../http.js";

// 分类类目
export const categoryNew = (data) => {
  return request({
    url: "/api/wanlshop.page/categoryNew",
    method: "POST",
    data,
  });
};

// 商品列表 /api/wanlshop.product/listsNew
export const listsNew = (data) => {
  return request({
    url: "/api/wanlshop.product/listsNew",
    method: "POST",
    data,
  });
};

// 商品详情
export const goodsDetail = (data) => {
  return request({
    url: "/api/wanlshop.product/goods?id=" + data.id,
    method: "POST",
    // header:{
    // 	"content-type":data.contentType
    // },
    // data:data.buffer
    data,
  });
};

// 优惠券列表
export const getCouponList = (data) => {
  return request({
    url: "/api/wanlshop/coupon/getList",
    method: "POST",
    data,
  });
};
// 领取优惠券
export const receiveCoupon = (data) => {
  return request({
    url: "/api/wanlshop/coupon/receive",
    method: "POST",
    data,
  });
};
// 我的优惠券列表
export const getMyCouponList = (data) => {
  return request({
    url: "/api/wanlshop/coupon/getMyList",
    method: "POST",
    data,
  });
};

// 购买时查询优惠券 /api/wanlshop/coupon/query
export const queryCouponList = (data) => {
  return request({
    url: "/api/wanlshop/coupon/query",
    method: "POST",
    data,
  });
};

// 商品评价列表 /api/wanlshop.product/comment
export const getCommentList = (data) => {
  console.log(data, 111);
  return request({
    url: "/api/wanlshop.product/comment",
    method: "POST",
    // header:{
    // 	"content-type":data.contentType
    // },
    data: data,
  });
};

// 商品收藏/取消收藏
export const followApi = (data) => {
  return request({
    url: "/api/wanlshop/product/follow",
    method: "POST",
    data,
  });
};

// 拼团 收藏 wanlshop/groups/product/follow
export const groupFollowApi = (data) => {
  return request({
    url: "/api/wanlshop/groups/product/follow",
    method: "POST",
    data,
  });
};

// 库存 /api/wanlshop/product/stock
export const goodsStock = (data) => {
  return request({
    url: "/api/wanlshop/product/stock",
    method: "POST",
    data,
  });
};

// 操作购物车
export const storageCart = (data) => {
  return request({
    url: "/api/wanlshop.cart/storage",
    method: "POST",
    data,
  });
};
// 获取或合并购物车
export const synchroCart = (data) => {
  return request({
    url: "/api/wanlshop.cart/synchro",
    method: "POST",
    data,
  });
};

// 确认下单 /api/wanlshop/order/getOrderGoodsList
export const getOrderGoodsList = (data) => {
  return request({
    url: "/api/wanlshop/order/getOrderGoodsList",
    method: "POST",
    data,
  });
};

// 下单 /api/wanlshop/order/addOrder
export const addOrder = (data) => {
  return request({
    url: "/api/wanlshop/order/addOrder",
    method: "POST",
    data,
  });
};
// 支付 /api/wanlshop.pay/payment
export const payment = (data) => {
  return request({
    url: "/api/wanlshop.pay/payment",
    method: "POST",
    data,
  });
};

// 拼团详情
export const productGoodsDetail = (data) => {
  return request({
    url: "/api/wanlshop/groups/product/goods?id=" + data.id,
    method: "POST",
    // header: {
    //   "content-type": data.contentType,
    // },
    // data: data
  });
};

// 拼团确认订单
export const groupsOrderGoodsList = (data) => {
  return request({
    url: "/api/wanlshop/groups/order/getOrderGoodsList",
    method: "POST",
    data,
  });
};
// 拼团下单
export const groupsAddOrder = (data) => {
  return request({
    url: "/api/wanlshop/groups/order/addOrder",
    method: "POST",
    data,
  });
};

// 获取余额 api/wanlshop/pay/getBalance
export const getBalance = (data) => {
  return request({
    url: "/api/wanlshop/pay/getBalance",
    method: "POST",
    data,
  });
};

// 分享商品二维码 /api/wanlshop/common/qrcode
export const goodesQrcode = (data) => {
  return request({
    url: "/api/wanlshop/common/qrcode",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};

// 猜你喜欢 /api/wanlshop/product/likes
export const getLikes = (data) => {
  return request({
    url: "/api/wanlshop/product/likes",
    method: "POST",
    data,
  });
};

// 商城 订单列表
export const goodsOrderList = (data) => {
  return request({
    url: "/api/wanlshop/order/getOrderList",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};
// 订单详情 /api/wanlshop.order/getOrderInfo
export const goodsOrderInfo = (data) => {
  console.log(data);
  return request({
    url: "/api/wanlshop.order/getOrderInfo?id=" + data.id,
    method: "POST",
    // header:{
    // 	"content-type":data.contentType
    // },
    // responseType: "arraybuffer",
    // data:data
  });
};

// order Pay /api/wanlshop.pay/payment
export const orderPayment = (data) => {
  return request({
    url: "/api/wanlshop.pay/payment",
    method: "POST",
    data,
  });
};

// 确认收货 /api/wanlshop/order/confirmOrder
export const receiptGoods = (data) => {
  return request({
    url: "/api/wanlshop/order/confirmOrder",
    method: "POST",
    data,
  });
};

// 取消订单 /api/wanlshop/order/delOrder
export const cancelOrder = (data) => {
  return request({
    url: "/api/wanlshop/order/cancelOrder",
    method: "POST",
    data,
  });
};

// 删除订单 /api/wanlshop/order/delOrder
export const delOrder = (data) => {
  return request({
    url: "/api/wanlshop/order/delOrder",
    method: "POST",
    data,
  });
};

// 拼团订单列表 /api/wanlshop/groups/order/getOrderList
export const groupsOrderList = (data) => {
  return request({
    url: "/api/wanlshop/groups/order/getOrderList",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};

// 拼团订单详情 /api/wanlshop/groups/order/getOrderInfo
export const groupsGetOrderInfo = (data) => {
  return request({
    url: "/api/wanlshop/groups/order/getOrderInfo",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};

// 拼团分享 信息 /api/wanlshop/groups/team/getGroupsDetails
export const teamShareGroups = (data) => {
  return request({
    url: "/api/wanlshop/groups/team/getGroupsDetails",
    method: "GET",
    data,
  });
};

// 评论订单 /api/wanlshop.order/commentOrder
export const commentOrder = (data) => {
  return request({
    url: "/api/wanlshop.order/commentOrder",
    method: "POST",
    data,
  });
};

// 商品订单修改地址 api/wanlshop/order/editOrderAddress
export const editOrderAddress = (data) => {
  return request({
    url: "/api/wanlshop/order/editOrderAddress",
    method: "POST",
    data,
  });
};

// 地址列表 /api/wanlshop/address/getaddress
export const getaddress = (data) => {
  return request({
    url: "/api/wanlshop/address/getaddress",
    method: "POST",
    data,
  });
};

// 修改新增地址 /api/wanlshop/address/address
export const updataAddress = (data) => {
  return request({
    url: "/api/wanlshop/address/address",
    method: "POST",
    data,
  });
};

// 地区列表 /api/wanlshop/common/area
export const getArea = (data) => {
  return request({
    url: "/api/wanlshop/common/area",
    method: "GET",
    data,
  });
};

// 删除地址 /api/wanlshop/address/deladdress
export const deladdress = (data) => {
  return request({
    url: "/api/wanlshop/address/deladdress",
    method: "POST",
    data,
  });
};

// 售后列表 /api/wanlshop/refund/refundList
export const refundList = (data) => {
  return request({
    url: "/api/wanlshop/refund/refundList",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};

// 退款申请 /api/wanlshop/refund/addApply
export const addApply = (data) => {
  return request({
    url: "/api/wanlshop/refund/addApply",
    method: "POST",
    data,
  });
};

// 售后详情 /api/wanlshop/refund/getRefundInfo
export const getRefundInfo = (data) => {
  return request({
    url: "/api/wanlshop/refund/getRefundInfo",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};

// 撤销申请 /api/wanlshop/refund/closeRefund
export const closeRefund = (data) => {
  return request({
    url: "/api/wanlshop/refund/closeRefund",
    method: "POST",
    header: {
      "content-type": data.contentType,
    },
    responseType: "arraybuffer",
    data: data.buffer,
  });
};
// 查询物流 /api/wanlshop/order/getLogistics
export const getLogistics = (data) => {
	console.log(data, 'getLogisticsgetLogistics')
	return request({
    url: "/api/wanlshop/order/getLogistics",
    method: "POST",
    data,
  });
};